<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>

<form:form commandName="task" cssClass="form-horizontal" role="form">
    <c:if test="${empty logs}">
        <div class="form-group">
            <label class="col-sm-2 control-label no-padding-right" style="color: #761c19">无督查要求记录！</label>
        </div>
    </c:if>
    <c:if test="${not empty logs}">
        <div class="form-group">
            <label class="col-sm-2 control-label no-padding-right" style="color: #761c19">督查要求列表:</label>
        </div>
    </c:if>
    <c:forEach items="${logs}" var="logs">
        <div class="form-group">
            <label class="col-sm-1 control-label no-padding-right">时间</label>
            <div class="col-sm-2">
                <input type="text" value="${logs.datatime}" readonly="readonly" class="form-control ">
            </div>

                <%--<label class="col-sm-1 control-label no-padding-right" >任务时限</label>
                <div class="col-sm-2">
                    <c:choose>
                        <c:when test="${not empty logs.deadline}">
                            <input type="number" readonly="readonly" value="${logs.deadline}" maxlength="2" min="1" max="99"
                                   class="form-control ">
                        </c:when>
                        <c:otherwise>
                            <input type="number" readonly="readonly" placeholder="无" value="${logs.deadline}" maxlength="2"
                                   min="1" max="99" class="form-control ">
                        </c:otherwise>
                    </c:choose>
                </div>--%>

            <label class="col-sm-1 control-label no-padding-right">督查方式</label>
            <div class="col-sm-3">
                <input type="text" title="${logs.methonName}" value="${logs.methonName}" readonly="readonly"
                       placeholder="" class="form-control">
            </div>

            <div class="col-sm-2">
                <button type="button" class="btn btn-sm btn-primary downloadFile" data-id="${logs.taxproof}"
                        style="width: 100%;">下载附件
                </button>
            </div>

        </div>

        <div class="form-group">
            <label class="col-sm-1 control-label no-padding-right">督查情况</label>
            <div class="col-sm-11">
                <textarea rows="3" class="form-control" placeholder="督查情况"
                          readonly="readonly">${logs.supervisionAsk}</textarea>
            </div>
        </div>

        <hr width="100%;height:2px;">

    </c:forEach>
    <form:hidden path="sysId"/>
</form:form>
<script type="text/javascript">
    /**
     * 下载
     */
    $(".downloadFile").click(function () {
        var id = $(this).data("id");
        var url = "/communal/download/" + id;
        window.open(url);
    });

    jQuery(function ($) {
        $('.date-picker').datepicker({
            inline: true,
            format: "yyyymmdd",
            autoclose: true,
            todayHighlight: true,
            language: 'cn'
        })
        //show datepicker when clicking on the icon
            .next().on(ace.click_event, function () {
            $(this).prev().focus();
        });


        $(".downloadFile").each(function () {
            if (isEmpty($(this).data("id"))) {
                $(this).attr("style", "display:none;");
            }
        });
    });

    //更新操作
    $("#showDetail").click(function () {
        showView();
    });
</script>